// 思路结果
import { nanoid } from 'nanoid';
import React from 'react';
import DropDownSelect from './DropDownSelect';
import { AnalyzeIcon } from './svg.js';
const ThinkingResult: React.FC<any> = ({
  data,
  triggerReference,
  triggerArticleMain,
  setAILogs,
}) => {
  const list = data?.list || [];
  const keyword = data?.keyword || '';
  // const handleThinking = (item) => {
  //   console.log(item);

  //   // 将用户输入的指令添加到对话历史
  //   let userInput = {
  //     key: nanoid(),
  //     type: 'userRecover',
  //     data: item,
  //   };
  //   setAILogs((prev) => [...prev, userInput]);
  //   setTimeout(() => {
  //     let systemTxtRecover = {
  //       key: nanoid(),
  //       type: 'systemTxtRecover',
  //       spend: 30,
  //       data: [`好的，小麦正在更新文章大纲`],
  //     };
  //     setAILogs((prev: any) => [...prev, systemTxtRecover]);
  //   }, 500);
  // };

  return (
    <div className="thinkingResultBox">
      <div className="thinkingResultTitle">
        针对“{keyword}”主题，以下是小麦为您提供的观点和思路：
      </div>
      <div className="thinkingResultListBox">
        {list.length > 0 &&
          list.map((item: any) => (
            <div className="thinkingResultList" key={nanoid()}>
              <div
                className="thinkingResult-hd"
                // onClick={() => {
                //   handleThinking(item);
                // }}
              >
                {item}
              </div>
              <div className="thinkingResult-bd">
                <DropDownSelect
                  item={{ main_body: item, subject: '' }}
                  triggerReference={triggerReference}
                  triggerArticleMain={triggerArticleMain}
                  setAILogs={setAILogs}
                >
                  <span className="thinkingResultBtn">
                    <AnalyzeIcon />
                  </span>
                </DropDownSelect>
              </div>
            </div>
          ))}
      </div>
    </div>
  );
};

export default ThinkingResult;
